package com.ruoyi.cfuser.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/rescue")
public class RabbitMQController {
    @Resource
    private RabbitTemplate rabbitTemplate;

    @PostMapping("/rabbit")
    public void rabbit(@RequestBody String id) throws InterruptedException {
        rabbitTemplate.convertAndSend("task_exchange", "task.msg", id);
    }
}
